package jdk.io;

import java.io.*;

/**
 * 数据流, 以常用的数据类型把数据写入或读出流.
 */
public class DataStreamTest {

    public static void main(String[] args) throws IOException {

        test2();

    }

    static void test1() throws IOException {
        File file = new File("d://DataStreamTest.txt");
        DataOutputStream dos = new DataOutputStream(new FileOutputStream(file));
        dos.writeUTF("愿我生而无畏，正大光明。");
        dos.writeLong(1l);
        dos.close();

        DataInputStream dis = new DataInputStream(new FileInputStream(file));
        System.out.println(dis.readUTF());
    }

    static void test2() throws IOException{
        File file = new File("d:/chunkData-1");
        DataInputStream dos = new DataInputStream(new BufferedInputStream(new FileInputStream(file), 1000));
        while(true){
            System.out.println(dos.readLong());
        }

    }
}
